﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InfoTypeManager.aspx.cs"
    Inherits="SDZJ.ManagerView.InfomationManager.InfoTypeManager" %>
    <%@ Register Assembly="AspNetPager"   Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Assembly="SDZJ" Namespace="SDZJ.ExtendControls" TagPrefix="ExtendControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    
    <link  href="../../Styles/jquery-ui-1.8.11.custom.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/css.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/Outlook.css"  rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/jquery-1.4.1-vsdoc.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>         <script type="text/javascript"  src="../../Scripts/jquery-1.5.1.min.js"></script>
     <script type="text/javascript"  src="../../Scripts/jquery-ui-1.8.11.custom.min.js"></script>
    <style>
        /* Z-index of #mask must lower than #boxes .window */
        #mask
        {
            position: absolute;
            z-index: 9000;
            background-color: #FFF;
            display: none;
        }
        #boxes .window
        {
            background-color:#f3f3f3;
            position: absolute;
            width:  auto;
            height:  auto;
            display: none;
            z-index: 9999;
            padding: 1px;
        }
        /* Customize your modal window here, you can add background image too */
        #boxes #dialog
        {
            border-style:solid;
            border-color:#CFE5C9;
            width: 350px;
            height: auto;
            padding: 1px;
        }
    </style>
    
    <script language="javascript" type="text/javascript">

        $(document).ready(function () {
            //select all the a tag with name equal to modal 

            $('#btnModel').click(showDiv);
           // $('#elbtnSearch').click(showDiv);
            

            $('#btnEditType').click(showeditdiv);

        });

        function showDiv() {
            $("#txtCode").attr("disabled", false);
            $("#btnEdit").hide();
            $("#btnOK").show();
            var maskHeight = $(document).height();
            var maskWidth = $(window).width();
            //Set heigth and width to mask to fill up the whole screen 
            $('#mask').css({ 'width': maskWidth, 'height': maskHeight });
            //transition effect 
            $('#mask').fadeIn(1000);
            $('#mask').fadeTo("slow", 0.8);
            //Get the window height and width 
            var winH = $(window).height();
            var winW = $(window).width();
            //Set the popup window to center 
            $("#dialog").css('top', winH / 2 - $("#dialog").height());
            $("#dialog").css('left', winW / 2 - $("#dialog").width() / 2);
            //transition effect 
            $("#dialog").fadeIn(1000);
        }

        function closeDiv() {
            $('#mask, .window').fadeOut(500);
            $("#txtCode").val("");
            $("#txtType").val("");
        }

        function addreuslt(msg) {
            if (msg == "") {
                $('#mask, .window').fadeOut(500); // hide();
                $("#txtCode").val("");
                $("#txtType").val("");
            }
            else
                alert(msg);

        }

        function showeditdiv() {
            //alert($("#txtId").val());
            if ($("#txtId").val() == "")
                return;
            showDiv();
            var code = $("#txtId").val();
            var value = $("#txtValue").val();
            $("#txtCode").attr("disabled", true);
            $("#txtCode").val(code);
            $("#txtType").val(value);
            $("#btnEdit").show();
            $("#btnOK").hide();
        }

        function editdiv(code, type) {
            showDiv();
            $("#txtCode").attr("disabled", true);
            $("#txtCode").val(code);
            $("#txtType").val(type);
            $("#btnEdit").show();
            $("#btnOK").hide();
        }

        function checkvalue(){
            if ($("#txtCode").val() == "") {
                alert("请输入信息类别编码！");
                return false;
            }
            if ($("#txtCode").val().length>4) {
                alert("信息类别编码长度最大为四位！");
                return false;
            }
            if ($("#txtType").val() == "") {
                alert("请输入信息类别！");
                return false;
            }
            return true;
        }


    </script>
</head>
<body>
    <form id="form1" runat="server">
   <asp:ScriptManager ID="ScriptManager1" runat="server" >
    </asp:ScriptManager>
    <div id="boxes">
        <!-- #customize your modal window here -->
        <div id="dialog" class="window">
            <table width="100%">
                <tr style="background: url(../../images/bor02.jpg) repeat;">
                    <td>
                        添加信息类别
                    </td>
                </tr>
                <tr>
                    <td>
                        <fieldset>
                            <table width="100%" cellpadding="5px">
                                <tr>
                                    <td align="right" width="30%">
                                        信息类别编号:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
                                        <font color="red"><b>*</b></font>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" width="30%">
                                        信息类别:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtType" runat="server"></asp:TextBox>
                                        <font color="red"><b>*</b></font>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2">
                                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                            <ContentTemplate>
                                                <asp:Button ID="btnOK" runat="server" Text="确定" OnClick="btnOK_Click" OnClientClick="return checkvalue();"/>
                                                <asp:Button ID="btnEdit" runat="server" Text="修改" OnClick="btnEdit_Click" OnClientClick="return checkvalue();" style="display:none;"/>
                                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="button" id="btnCanel" value="取消"  onclick="closeDiv();" />
                                                <asp:TextBox ID="txtId"  runat="server" style="display:none"></asp:TextBox>
                                                <asp:TextBox ID="txtValue"  runat="server" style="display:none"></asp:TextBox>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                        
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                </tr>
            </table>
        </div>
        <!-- Do not remove div#mask, because you'll need it to fill the whole screen -->
        <div id="mask">
        </div>
    </div>
    
    
    <div class="scroll" id="right">
        <table width="100%">
            <tr>
                <td height="42" class="right_title">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                
                        <tr>
                            <td width="15%" class="title_l">
                                <img alt="信息设置" src="../../images/icon_02.jpg" width="9" height="9" />
                                信息设置
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
             
            <tr>
                <td height="20" style="background: #CFE5C9;">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="100%" align="left">
                           
                             <%--<ExtendControls:ExtendLinkButton ID="elbtnSearch" runat="server" CssClass="Toolbar"
                                        Text="搜索" ToolTip="搜索" ImgCss="ToolbarImg" TxtCss="ToolbarTxtWithImg" ImageUrl="../../images/add.gif"
                                       ></ExtendControls:ExtendLinkButton>--%>
                                      
                                 <%-- <ExtendControls:ExtendLinkButton ID="btnAdd" runat="server" ImageUrl="~/images/add.gif" Text="新增"></ExtendControls:ExtendLinkButton>--%>
                                <%-- <asp:Button  ID="test" Text="aa" runat="server" style="background-image:../../images/icon_02.jpg;"/>--%>
                                <%--  <asp:ImageButton ID="btnAdd" runat="server" ImageUrl="~/images/add.gif" AlternateText="aaa"/>
                                信息设置--%>
                                <%-- <img alt="信息设置" src="../../images/icon_02.jpg" width="9" height="9">aaaa</img>--%>
                                <%-- <asp:ImageButton ID="btnAdd" runat="server" ImageUrl="~/images/add.gif" />&nbsp;添加信息类别--%>
                               
                               <input id="btnModel" value="添加" type="button" />
                                <input id="btnEditType" value="编辑" type="button" />
                                <input id="btnDel" value="删除" type="button" OnClientClick ="return confirm('确定删除当前记录？');" OnClick="btnDel_Click"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
               
                <td>
                 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="grvNewsType" runat="server" CssClass="list"  OnRowDataBound="grvNewsType_RowDataBound"
                         AutoGenerateColumns="False" 
                        AutoGenerateSelectButton="True" onrowcreated="grvNewsType_RowCreated" 
                        onselectedindexchanged="grvNewsType_SelectedIndexChanged">
                       
                        <Columns>
                            <asp:TemplateField HeaderText="信息类别">
                                <ItemTemplate>
                                    <asp:Label ID="lblNewType" runat="server" Text='<%#Eval("newstype")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="信息类别编码">
                                <ItemTemplate>
                                    <asp:Label ID="lblNewTypeCode" runat="server" Text='<%#Eval("newstypecode")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                           <%-- <asp:TemplateField HeaderText="编辑" ItemStyle-HorizontalAlign="Center">
                               <ItemTemplate>
                                    <asp:ImageButton runat="server" ID="btnEdit" ImageUrl="../../images/edit.gif"   OnCommand="elbtnEdit_Command" CommandName='<%# Eval("newstypecode") %>'/> 
                               </ItemTemplate>              
                              </asp:TemplateField>
                              <asp:TemplateField HeaderText="删除"  ItemStyle-HorizontalAlign="Center"> 
                                  <ItemTemplate>
                                  <asp:ImageButton runat="server" ID="btnDelete" ImageUrl="../../images/delete.gif"  OnClientClick ="return confirm('确定删除当前记录？');" OnCommand="elbtnDelete_Command" CommandName='<%# Eval("newstypecode") %>'/> 
                                  </ItemTemplate>                    
                              </asp:TemplateField>--%>
                        </Columns>
                    </asp:GridView>
                    </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td class="page" align="right">
               
                    <webdiyer:aspnetpager id="AspNetPager" runat="server" pagesize="10" firstpagetext="<img src=../../images/page03.gif border=0 valign=middle hspace=3>"
                        lastpagetext="<img src=../../images/page04.gif border=0 valign=middle hspace=3>" nextpagetext="<img src=../../images/page02.gif border=0 valign=middle hspace=3>"
                        prevpagetext="<img src=../../images/page01.gif border=0 valign=middle hspace=3>" showcustominfosection="Left"
                        showpageindex="False" textafterpageindexbox="页" textbeforepageindexbox="转到" alwaysshow="True"
                        custominfoclass="pageLine"  showpageindexbox="Always" 
                        custominfosectionwidth="" wrap="False" submitbuttonclass="go" submitbuttonstyle="line-height:16px"
                        submitbuttontext=" ">
                 </webdiyer:aspnetpager>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
